Technical details

Background info for developers who want to understand what's happening under the hood. For step-by-step usage, see HowToCreateAPlugin.md instead.

The comhost mechanism

EnableComHosting=true makes the .NET SDK automatically generate the native *.comhost.dll alongside your managed .dll — this is the file regsvr32 registers, and what Windows actually loads via CoCreateInstance. It reads your class's [Guid(...)], starts CoreCLR, and hands back an instance of your class as a COM object. Nothing to build or maintain yourself here — see Microsoft's docs on ".NET COM hosting" for the full details.

The .MIF file

A small UTF-16LE manifest PCSELCAD reads from its own system directory (next to pcselcad.exe) to learn about a plugin — its own enrolment mechanism, unrelated to COM itself. [Modul] holds the display title; [Plugin] holds one indexed entry set per menu item (Menu1=, Name1=, Cmd1=, Index1=), where Cmd1 is the CLSID in {...} form. Must be named [Modul] (not [Module]) and saved as Unicode, or PCSELCAD shows the file's path instead of its title.

The plugin interface (IPCsPluginSimple)

The fixed COM contract PCSELCAD activates every plugin through — its IID (7020B4F9-25D5-47AF-BAAB-BFE710DD32AA) is owned by PCSELCAD, not by any individual plugin, so it must never change. Two members, called once in order after activation:

  1. SetPCsApplication(object pcsApp) — hands you PCSELCAD's live application object.
  2. Execute() — do the plugin's work here. Return true to release immediately, false to stay resident for the session.

Your own class (PCsPlugin) has its own [Guid(...)] — the CLSID, unique per plugin, matching Cmd1 in the .MIF file.